package com.langfeiyes.pattern.observer.demo3;


import java.util.Observable;

//目标对象：商品
public class ProductObserver extends Observable {
    private String name;
    public ProductObserver(String name){
        this.name = name;
    }
    //进货
    public void stock(int count){
        System.out.println("商家最新进货，上架商品：" +this.name+ "，共" + count +" 部");
        super.setChanged(); //改变状态
        notifyObservers();  //发起通知
    }
    public String getName() {
        return name;
    }
}
